package com.hua.nailcampus.acl.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hua.nailcampus.acl.mapper.AvatarMapper;
import com.hua.nailcampus.acl.model.Avatar;
import com.hua.nailcampus.acl.service.AvatarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author:chenjianhua
 * @Date:2023/11/15 20:01
 * @Version 17
 */
@Service
public class AvatarServiceImpl extends ServiceImpl<AvatarMapper, Avatar>
    implements AvatarService {

    @Autowired
    private AvatarMapper avatarMapper;

    @Override
    public Avatar getAvatarByUserId(Integer id) {
//        根据用户Id查询头像数据并返回
        Avatar avatar = avatarMapper.selectOne(
                new LambdaQueryWrapper<Avatar>()
                        .eq(Avatar::getUserId, id));
        return avatar;
    }
}
